<template>
  <div class="title-card-box" :class="shadow ? 'is-card-shadow' : ''">
    <el-card shadow="never">
      <template #header>
        <div class="header-box">
          <div class="header-left">
            <div class="title-line"></div>
            <slot name="card-title">
              <span class="card-title">{{ title }}</span>
            </slot>
            <slot name="info">
              <span class="card-info" v-if="info">{{ info }}</span>
            </slot>
            <slot name="edit"></slot>
          </div>
          <div class="header-right">
            <slot name="header-right"></slot>
          </div>
        </div>
      </template>
      <slot></slot>
    </el-card>
  </div>
</template>

<script>
export default {
  name: "TitleCard",
  props: {
    title: {
      type: String,
      default: "",
    },
    info: {
      type: String,
      default: "",
    },
    shadow: {
      type: Boolean,
      default: false,
    },
    bottomBorder: {
      type: Boolean,
      default: false,
    },
  },
};
</script>

<style scoped lang="scss">
.is-card-shadow {
  -webkit-box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
  box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
}

.title-card-box {
  box-sizing: border-box;

  ::v-deep .el-card {
    border: none !important;
    border-radius: 0 !important;
  }

  ::v-deep .el-card__header {
    padding: 0 0 15px 0;
    //border-bottom: none;
    min-height: 0;
  }

  ::v-deep .el-card__body {
    padding: 10px 0 0 0;
  }

  .header-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    //height: 40px;

    .header-left {
      display: flex;
      align-items: center;

      .title-line {
        display: inline-block;
        width: 4px;
        height: 16px;
        background-color: #3184ff;
        border-radius: 2px;
      }

      .card-title {
        margin-left: 5px;
        font-size: 16px;
        font-family: Microsoft YaHei-Bold, Microsoft YaHei;
        font-weight: bold;
        color: #333333;
      }

      .card-info {
        background-color: #fff3f3;
        border-radius: 15px;
        height: 30px;
        line-height: 30px;
        padding: 0 10px;
        font-size: 12px;
        font-weight: 400;
        color: #ff6867;
        margin-left: 30px;
      }
    }

    .header-right {
    }
  }
}
</style>
